<?php
class Solicitudes_Form_Valoracion extends Form_Base{
	
    protected $gradosEscala;
		
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function setGradosEscala($gradosEscala) {
		$this->gradosEscala = $gradosEscala;
	}
	
	public function init() {
	    $domConfig = Zend_Registry::get('domConfig');
		$this->setName('valoracion');
		$this->setMethod("post");
		
		$elements[] = new Zend_Form_Element_Hidden("codtramiteseccion");
		$elements[] = new Zend_Form_Element_Hidden("codtramiteelemento");
		    
	    $element = new Zend_Form_Element_Radio("codescala");
	    $element->setLabel("");
	    $element->addMultiOptions($this->gradosEscala);
	    $element->setRequired(true);
	    $elements[] = $element;
		
        $element = new Zend_Form_Element_Text("valoracion");
        $element->setLabel("Grado de cumplimiento : ");
        $element->setRequired(true);
        $element->addFilter('StripTags');
        $element->addFilter('StringTrim');
//        $element->setAttrib("size",3);
        $element->addValidator(new Zend_Validate_Float(new Zend_Locale("en_US")));
        $element->addValidator(new Zend_Validate_GreaterThan(0));
        $elements[] = $element;
		
        $element = new Zend_Form_Element_Text("porcentaje");
//        $element->setLabel("Valor porcentual : ");
        $element->helper = "formNote";
        $element->setAttrib("readonly", "readonly");
        $element->setAttrib("size", 7);
        $elements[] = $element;
        
        $element = new Zend_Form_Element_Textarea("justificacionvaloracion");
        $element->setLabel("Análisis característica : ");
		$element->setRequired(true);
        $element->addFilter('StripTags');
		$element->addFilter('StringTrim');
//		$element->addFilter('StringToUpper');
		$element->setAttrib("rows",5);
		$element->setAttrib("maxlength",$domConfig->TEXTO_TAMANOMAX);
		$elements[] = $element;
       
		$element = new Zend_Form_Element_Submit('btnSubmit');
		$element->setLabel('Guardar');
		$element->setValue('Guardar');
		$element->setAttrib("class", "iceCmdBtn");
		$elements[] = $element;
		
		$this->addElements ($elements);

		$this->loadTableDecorators();
//	    $this->loadViewScriptDecorators();
	}
	
	public function loadViewScriptDecorators() {
		$this->setDecorators ( array (array ('viewScript', array ('viewScript' => 'viewscripts/valoracion_form.phtml' ) ) ) );
	}
	
}
